<%@ page import="java.sql.Connection" %>
<%@ page import="java.sql.DriverManager" %>
<%@ page import="java.sql.Statement" %>
<%@ page import="java.sql.ResultSet" %><%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2021/12/26
  Time: 15:18
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" import="java.sql.*" %>
<html>
<head>
    <title>Title</title>
<body>
    <table align="center">
        <caption></caption>
        <tr bgcolor="yellow">
            <td>编号</td>
            <td>姓名</td>
            <td>得票数</td>
            <td>投票</td>
        </tr>
        <%
            Class.forName("com.mysql.cj.jdbc.Driver");
            Connection conn = DriverManager.getConnection("jdbc:odbc:DSSchool");
            Statement stat = conn.createStatement();
            String sql = "select teacherno,teachername,bote from t_vote";
            ResultSet rs = stat.executeQuery(sql);
            while (rs.next()){
                String teacherno = rs.getString("teacherno");
                String teachername = rs.getString("tachername");
                int vote = rs.getInt("vote");

        %>
        <tr bgcolor="#ffc0cb">
            <td><%=teacherno %></td>
            <td><%=teachername %></td>
            <td><img src="img/bar.gph" width=<%=vote %> height="10"><%=vote %></td>
            <td><a href="vote.jsp?teacherno<%=teacherno %>"></a></td>
        </tr>
        <%
            }
            stat.close();
            conn.close();
        %>
    </table>
    </body>
</head>

</html>
